package mo.org.cm309.shoppingcart.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import mo.org.cm309.shoppingcart.entity.Cart;

public class ShowCartServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		Cart cart = (Cart)req.getSession().getAttribute("cart");
		if (cart == null) {
			cart = new Cart();
		}
		req.getSession().setAttribute("cart", cart);
		req.getRequestDispatcher("/showCart.jsp").forward(req, resp);
	}
}
